package com.nine.pattern.adapter.object_adapter;


/**
 * @author nine
 * @version 1.0
 * @description 类适配器，违反了合成复用原则。类适配器是客户类有一个接口规范的情况下可用，如果没有就没法使用
 * @date 2024-07-08 22:00
 */
public class SDAdapterTF implements SDCard {

	// 声明适配者类
	private TFCard tfCard;

	public SDAdapterTF(TFCard tfCard) {
		this.tfCard = tfCard;
	}

	@Override
	public String readSD() {
		System.out.println("adapter read tf card");
		return tfCard.readTF();
	}

	@Override
	public void writeSD(String msg) {
		System.out.println("adapter write tf card");
		tfCard.writeTF(msg);
	}
}
